package com.dmgis.qxfw.dataservice.bigdata.service.impl;


import com.dmgis.qxfw.dataservice.bigdata.service.InfoDisplayService;
import com.dmgis.qxfw.dataservice.businessservice.api.domain.DbConfig;
import com.dmgis.qxfw.dataservice.businessservice.api.domain.RequestDataBySelect;
import com.dmgis.qxfw.dataservice.businessservice.api.entity.ny.agri_moni_info;
import com.dmgis.qxfw.dataservice.businessservice.api.entity.ny.diseasemonitorinfo;
import com.dmgis.qxfw.dataservice.businessservice.api.entity.qx.msgmediumsmallscale;
import com.dmgis.qxfw.dataservice.businessservice.api.entity.qx.msgmediumsmallscale;
import com.dmgis.qxfw.dataservice.businessservice.api.entity.xt.collect_log_monitor;
import com.dmgis.qxfw.dataservice.businessservice.api.entity.yj.*;
import com.dmgis.qxfw.dataservice.businessservice.api.entity.zy.product_count;
import com.dmgis.qxfw.dataservice.businessservice.common.util.HttpRequestUtil;
import com.dmgis.qxfw.dataservice.businessservice.common.util.JsonUtil;
import com.dmgis.qxfw.dataservice.businessservice.common.util.StringUtil;
import com.dmgis.qxfw.dataservice.businessservice.controller.ProcessRequestController;
import com.fasterxml.jackson.core.type.TypeReference;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.*;

@Service
public class InfoDisplayImpl implements InfoDisplayService {

    HttpRequestUtil httpUtil = new HttpRequestUtil();

    ProcessRequestController pc = new ProcessRequestController();

    @Override
    public List<collect_log_monitor> getCollectNumByTimeRange() {
        // TODO 采集统计
        Date data=new Date();

        SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
        String format1 = format.format(data);
        List<collect_log_monitor> listData=new ArrayList<collect_log_monitor>();
        Map<String, String> selectParam = new HashMap<String, String>();
        RequestDataBySelect selectRequest = new RequestDataBySelect();
        List<String> columns = new ArrayList<String>();
        columns.add("name");
        columns.add("sum(remark) as remark");
        selectRequest.setColumns(columns.toArray(new String[columns.size()]));
        selectRequest.setSort(new String[] { "remark desc"});
        selectRequest.setParam(String.format("state='成功' and to_char(monitortime,'yyyy-MM-dd')='%s' and name not in('水文站','气象干旱','土壤湿度','环保实况')","2019-09-11"));//时间先写的死的需要修改
        selectRequest.setLimit(10);
        try {
            selectParam.put("method", "collect_log_monitor");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message = pc.processRequest(selectParam);
            listData = JsonUtil.jsonStr2TypeReference(message, new TypeReference<List<collect_log_monitor>>() {
            });
        } catch (Exception e) {
            // TODO: handle exception
        }
        return listData;

    }

    @Override
    public List<Map<String, Object>> getMonitorNumByTimeRange()
    {
        Map<String, Object> seriesItemMap = null;
        List<Map<String, Object>> seriesList = new ArrayList<>();
        ArrayList arrlist=new ArrayList();
        List<warn_moni_info> listData=new ArrayList<warn_moni_info>();  //气象要素
//        List<dzwarn_moni_info> listData1=new ArrayList<dzwarn_moni_info>(); //地质灾害雨量
//        List<slwarn_moni_info> listData2=new ArrayList<slwarn_moni_info>(); //山洪防汛雨量
        List<radar_warn_monitor_info> listData3=new ArrayList<radar_warn_monitor_info>();///雷达信息
        List<thunder_moni_info> listData4=new ArrayList<thunder_moni_info>();//雷电信息
        List<warn_signal_info> listData5=new ArrayList<warn_signal_info>();//预警信号
        List<disweather_moni_info> listData6=new ArrayList<disweather_moni_info>(); //灾害性天气
        List<water_warn_moni_info> listData7=new ArrayList<water_warn_moni_info>();  //水务水情
        List<agri_moni_info> listData8=new ArrayList<agri_moni_info>();  //农情信息
        List<diseasemonitorinfo> listData9=new ArrayList<diseasemonitorinfo>();//农业病虫害
        List<imp_weather_moni_info> listData10=new ArrayList<imp_weather_moni_info>(); //重要天气监控
        Map<String, String> selectParam = new HashMap<String, String>();
        RequestDataBySelect selectRequest = new RequestDataBySelect();
        try {
            selectParam.put("method", "warn_moni_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message = pc.processRequest(selectParam);
            listData = JsonUtil.jsonStr2TypeReference(message, new TypeReference<List<warn_moni_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData.size());
            seriesItemMap.put("name", "气象要素");
            seriesList.add(seriesItemMap);


//            selectParam = new HashMap<String, String>();
//            selectParam.put("method", "dzwarn_moni_info");
//            selectParam.put("sqlType", "select");
//            selectParam.put("param", JsonUtil.object2Json(selectRequest));
//            String message1 = httpUtil.sendGet(DbConfig.YJURL, selectParam);
//            listData1 = JsonUtil.jsonStr2TypeReference(message1, new TypeReference<List<dzwarn_moni_info>>() {
//            });
//            seriesItemMap = new HashMap<String, Object>();
//            seriesItemMap.put("value", listData1.size());
//            seriesItemMap.put("name", "地质灾害雨量");
//            seriesList.add(seriesItemMap);

//            selectParam = new HashMap<String, String>();
//            selectParam.put("method", "slwarn_moni_info");
//            selectParam.put("sqlType", "select");
//            selectParam.put("param", JsonUtil.object2Json(selectRequest));
//            String message2 = httpUtil.sendGet(DbConfig.YJURL, selectParam);
//            listData2 = JsonUtil.jsonStr2TypeReference(message2, new TypeReference<List<slwarn_moni_info>>() {
//            });
//            seriesItemMap = new HashMap<String, Object>();
//            seriesItemMap.put("value", listData2.size());
//            seriesItemMap.put("name", "山洪防汛雨量");
//            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "radar_warn_monitor_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message3 = pc.processRequest(selectParam);
            listData3 = JsonUtil.jsonStr2TypeReference(message3, new TypeReference<List<radar_warn_monitor_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData3.size());
            seriesItemMap.put("name", "雷达信息");
            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "thunder_moni_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message4 = pc.processRequest(selectParam);
            listData4 = JsonUtil.jsonStr2TypeReference(message4, new TypeReference<List<thunder_moni_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData4.size());
            seriesItemMap.put("name", "雷电信息");
            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "warn_signal_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message5 = pc.processRequest(selectParam);
            listData5 = JsonUtil.jsonStr2TypeReference(message5, new TypeReference<List<warn_signal_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData5.size());
            seriesItemMap.put("name", "预警信号");
            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "disweather_moni_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message6 = pc.processRequest(selectParam);
            listData6 = JsonUtil.jsonStr2TypeReference(message6, new TypeReference<List<disweather_moni_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData6.size());
            seriesItemMap.put("name", "灾害性天气");
            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "water_warn_moni_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message7 = pc.processRequest(selectParam);
            listData7 = JsonUtil.jsonStr2TypeReference(message7, new TypeReference<List<water_warn_moni_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData7.size());
            seriesItemMap.put("name", "水务水情");
            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "agri_moni_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message8 = pc.processRequest(selectParam);
            listData8 = JsonUtil.jsonStr2TypeReference(message8, new TypeReference<List<agri_moni_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData8.size());
            seriesItemMap.put("name", "农情信息");
            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "diseasemonitorinfo");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message9 = pc.processRequest(selectParam);
            listData9 = JsonUtil.jsonStr2TypeReference(message9, new TypeReference<List<diseasemonitorinfo>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData9.size());
            seriesItemMap.put("name", "农业病虫害");
            seriesList.add(seriesItemMap);

            selectParam = new HashMap<String, String>();
            selectParam.put("method", "imp_weather_moni_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message10 = pc.processRequest(selectParam);
            listData10 = JsonUtil.jsonStr2TypeReference(message10, new TypeReference<List<imp_weather_moni_info>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", listData10.size());
            seriesItemMap.put("name", "重要天气");
            seriesList.add(seriesItemMap);

        } catch (Exception e) {
            // TODO: handle exception
        }
        return seriesList;
    }

    @Override
    public List<warn_signal_info> getWarningSignByMonth(String where)
    {
        List<warn_signal_info> listData=new ArrayList<warn_signal_info>();//预警信号
        Map<String, String> selectParam = new HashMap<String, String>();
        RequestDataBySelect selectRequest = new RequestDataBySelect();
        selectRequest.setParam(String.format("to_char(announcedtime,'yyyy-MM')='%s'",where));
        selectRequest.setSort(new String[]{"announcedtime asc"});
        try {
            selectParam.put("method", "warn_signal_info");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message = pc.processRequest(selectParam);
            listData = JsonUtil.jsonStr2TypeReference(message, new TypeReference<List<warn_signal_info>>() {
            });
        } catch (Exception e) {
            // TODO: handle exception
        }
        return listData;
    }

    @Override
    public List<msgmediumsmallscale> getskPoint() {
        List<msgmediumsmallscale> listData = new ArrayList<msgmediumsmallscale>();
        Map<String, String> selectParam = new HashMap<String, String>();
        RequestDataBySelect selectRequest = new RequestDataBySelect();
        // 拼接where字段
        StringBuilder strWhere = new StringBuilder();
        int whereCount = 0;
        List<msgmediumsmallscale> msgList = getskNewtime();
        if(msgList !=null && msgList.size()>0) {
            Date nowdate = getskNewtime().get(0).getObservtime();
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(nowdate);
            calendar.add(Calendar.DATE, -1);
            Date startime = calendar.getTime();
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH");
            SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd HH");
            String start = simpleDateFormat.format(startime) + ":00:00";
            String end = simpleDateFormat1.format(nowdate) + ":00:00";
            System.out.println(start + "---" + end );
            strWhere.append(" and stationname='伊宁'");
            strWhere.append(String.format(" and observtime>='%s'", start));//nowtime"2019-09-05 12:00:00"
            strWhere.append(String.format(" and observtime<='%s'", end));//nowtime"2019-09-05 12:00:00"
            if (whereCount == 0 && !StringUtil.IsNullOrEmpty(strWhere.toString())) {
                strWhere = strWhere.replace(0, 4, "");
            }
            selectRequest.setParam(strWhere.toString());
            selectRequest.setColumns(new String[]{"rain,drybulbtemp,observtime"});
            selectRequest.setSort(new String[]{" observtime asc"});
            try {
                selectParam.put("method", "msgmediumsmallscale");
                selectParam.put("sqlType", "select");
                selectParam.put("param", JsonUtil.object2Json(selectRequest));
                String message = pc.processRequest(selectParam);
                listData = JsonUtil.jsonStr2TypeReference(message, new TypeReference<List<msgmediumsmallscale>>() {
                });
            } catch (Exception e) {
                // TODO: handle exception
            }
        }
        return listData;
    }
    @Override
    public List<Map<String, Object>> getCollectNum() {
        String message="";
        Map<String, Object> seriesItemMap = null;
        List<Map<String, Object>> seriesList = new ArrayList<>();

        Map<String, String> selectParam = new HashMap<String, String>();
        RequestDataBySelect selectRequest = new RequestDataBySelect();
        List<collect_log_monitor> listData=new ArrayList<>();
        // 拼接where字段
        StringBuilder strWhere = new StringBuilder();
        strWhere.append(" state='成功'");
        selectRequest.setColumns(new String[]{"name","sum(remark) AS remark"});

        strWhere.append(" and name in('水文站','气象干旱','土壤湿度','环保实况')");//nowtime"2019-09-05 12:00:00"
        selectRequest.setParam(strWhere.toString());
        try {
            selectParam.put("method", "collect_log_monitor");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
             message = pc.processRequest(selectParam);
            listData = JsonUtil.jsonStr2TypeReference(message, new TypeReference<List<collect_log_monitor>>() {
            });
            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", 717);
            seriesItemMap.put("name","地灾数据");
            seriesList.add(seriesItemMap);

            seriesItemMap = new HashMap<String, Object>();
            seriesItemMap.put("value", 100);
            seriesItemMap.put("name","农业数据");
            seriesList.add(seriesItemMap);
            if(listData.size()>0)
            {
                for(int i=0;i<listData.size();i++)
                {
                    seriesItemMap = new HashMap<String, Object>();
                    seriesItemMap.put("value", listData.get(i).getRemark());
                    if(listData.get(i).getName().contains("水文"))
                        seriesItemMap.put("name","水文数据");
                    else if(listData.get(i).getName().contains("环保"))
                        seriesItemMap.put("name","环保数据");
                    else
                        seriesItemMap.put("name",listData.get(i).getName());
                    seriesList.add(seriesItemMap);
                }
            }
        } catch (Exception e) {
            // TODO: handle exception
        }
        return seriesList;
    }

    /**
     *     实况最新时间查询
     * @return
     */
    public List<msgmediumsmallscale> getskNewtime() {
        // TODO 灾点查询
        List<msgmediumsmallscale> listData = new ArrayList<msgmediumsmallscale>();
        Map<String, String> selectParam = new HashMap<String, String>();
        RequestDataBySelect selectRequest = new RequestDataBySelect();
        // 拼接where字段
        StringBuilder strWhere = new StringBuilder();
        int whereCount = 0;
        strWhere.append(" and stationname='伊宁'");
        if (whereCount == 0 && !StringUtil.IsNullOrEmpty(strWhere.toString())) {
            strWhere = strWhere.replace(0, 4, "");
        }
        selectRequest.setParam(strWhere.toString());
        selectRequest.setColumns(new String[]{"observtime"});
        selectRequest.setSort(new String[]{" observtime desc"});
        selectRequest.setLimit(1);
        try {
            selectParam.put("method", "msgmediumsmallscale");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            String message = pc.processRequest(selectParam);
            listData = JsonUtil.jsonStr2TypeReference(message, new TypeReference<List<msgmediumsmallscale>>() {
            });
        } catch (Exception e) {
            // TODO: handle exception
        }
        return listData;
    }

    @Override
    public Object GetProductCount() {
        List<product_count> counts = new ArrayList<>();
        List<product_count> counts1 = new ArrayList<>();
        List<product_count> counts2 = new ArrayList<>();
        List<product_count> counts3 = new ArrayList<>();
        List<product_count> counts4 = new ArrayList<>();
        List<product_count> counts5 = new ArrayList<>();
        List<product_count> counts6 = new ArrayList<>();
        List<product_count> counts7 = new ArrayList<>();
        List<product_count> counts8 = new ArrayList<>();
        List<product_count> counts9 = new ArrayList<>();
        List<product_count> counts10 = new ArrayList<>();
        List<product_count> counts11 = new ArrayList<>();
        List<product_count> counts12 = new ArrayList<>();
        List<product_count> counts13 = new ArrayList<>();
        List<product_count> counts14 = new ArrayList<>();
        HashMap<Object,Object>  seriesItemMap=null;

        Map<String, String> selectParam = new HashMap<String, String>();
        RequestDataBySelect selectRequest = new RequestDataBySelect();
        List<String> columns = new ArrayList<String>();
        columns.add("count(*) as nycount");
        selectRequest.setColumns(columns.toArray(new String[columns.size()]));
        try {
            selectParam.put("method", "agri_product");
            selectParam.put("sqlType", "select");
            selectParam.put("param", JsonUtil.object2Json(selectRequest));
            selectParam.put("advCode", DbConfig.advCode);
            String message = pc.processRequest(selectParam);
            counts = JsonUtil.jsonStr2TypeReference(message, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam1 = new HashMap<String, String>();
            RequestDataBySelect selectRequest1 = new RequestDataBySelect();
            List<String> columns1 = new ArrayList<String>();
            columns1.add("count(*) as dlcount");
            selectRequest1.setColumns(columns1.toArray(new String[columns1.size()]));
            selectParam1.put("method", "power_product");
            selectParam1.put("sqlType", "select");
            selectParam1.put("advCode", DbConfig.advCode);
            selectParam1.put("param", JsonUtil.object2Json(selectRequest1));
            String message1 = pc.processRequest(selectParam1);
            counts1= JsonUtil.jsonStr2TypeReference(message1, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam2 = new HashMap<String, String>();
            RequestDataBySelect selectRequest2 = new RequestDataBySelect();
            List<String> columns2 = new ArrayList<String>();
            columns2.add("count(*) as rbcount");
            selectRequest2.setColumns(columns2.toArray(new String[columns2.size()]));
            selectParam2.put("method", "zhongbao_product");
            selectParam2.put("sqlType", "select");
            selectParam2.put("advCode", DbConfig.advCode);
            selectParam2.put("param", JsonUtil.object2Json(selectRequest2));
            String message2 = pc.processRequest(selectParam2);
            counts2= JsonUtil.jsonStr2TypeReference(message2, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam3 = new HashMap<String, String>();
            RequestDataBySelect selectRequest3 = new RequestDataBySelect();
            List<String> columns3 = new ArrayList<String>();
            columns3.add("count(*) as ttcount");
            selectRequest3.setColumns(columns3.toArray(new String[columns3.size()]));
            selectParam3.put("method", "disweather_moni_info");
            selectParam3.put("sqlType", "select");
            selectParam3.put("advCode", DbConfig.advCode);
            selectParam3.put("param", JsonUtil.object2Json(selectRequest3));
            String message3 = pc.processRequest(selectParam3);
            counts3= JsonUtil.jsonStr2TypeReference(message3, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam4 = new HashMap<String, String>();
            RequestDataBySelect selectRequest4 = new RequestDataBySelect();
            List<String> columns4 = new ArrayList<String>();
            columns4.add("count(*) as hbcount");
            selectRequest4.setColumns(columns4.toArray(new String[columns4.size()]));
            selectParam4.put("method", "airpol_reg_fcst");
            selectParam4.put("sqlType", "select");
            selectParam4.put("advCode", DbConfig.advCode);
            selectParam4.put("param", JsonUtil.object2Json(selectRequest4));
            String message4 = pc.processRequest(selectParam4);
            counts4= JsonUtil.jsonStr2TypeReference(message4, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam5 = new HashMap<String, String>();
            RequestDataBySelect selectRequest5 = new RequestDataBySelect();
            List<String> columns5 = new ArrayList<String>();
            columns5.add("count(*) as hbcount1");
            selectRequest5.setColumns(columns5.toArray(new String[columns5.size()]));
            selectParam5.put("method", "air_haze_warn");
            selectParam5.put("sqlType", "select");
            selectParam5.put("advCode", DbConfig.advCode);
            selectParam5.put("param", JsonUtil.object2Json(selectRequest5));
            String message5 = pc.processRequest(selectParam5);
            counts5= JsonUtil.jsonStr2TypeReference(message5, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam6 = new HashMap<String, String>();
            RequestDataBySelect selectRequest6 = new RequestDataBySelect();
            List<String> columns6 = new ArrayList<String>();
            columns6.add("count(*) as hbcount2");
            selectRequest6.setColumns(columns6.toArray(new String[columns6.size()]));
            selectParam6.put("method", "airpol_con_fcst");
            selectParam6.put("sqlType", "select");
            selectParam6.put("advCode", DbConfig.advCode);
            selectParam6.put("param", JsonUtil.object2Json(selectRequest6));
            String message6 = pc.processRequest(selectParam6);
            counts6= JsonUtil.jsonStr2TypeReference(message6, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam7 = new HashMap<String, String>();
            RequestDataBySelect selectRequest7 = new RequestDataBySelect();
            List<String> columns7 = new ArrayList<String>();
            columns7.add("count(*) as hbcount3");
            selectRequest7.setColumns(columns7.toArray(new String[columns7.size()]));
            selectParam7.put("method", "airpol_fcst_final");
            selectParam7.put("sqlType", "select");
            selectParam7.put("advCode", DbConfig.advCode);
            selectParam7.put("param", JsonUtil.object2Json(selectRequest7));
            String message7 = pc.processRequest(selectParam7);
            counts7= JsonUtil.jsonStr2TypeReference(message7, new TypeReference<List<product_count>>() {
            });


            Map<String, String> selectParam8 = new HashMap<String, String>();
            RequestDataBySelect selectRequest8 = new RequestDataBySelect();
            List<String> columns8 = new ArrayList<String>();
            columns8.add("count(*) as yjcount");
            selectRequest8.setParam("producttype in('安监应急','应急服务','地灾应急','山洪应急','城市火险预报')");
            selectRequest8.setColumns(columns8.toArray(new String[columns8.size()]));
            selectParam8.put("method", "base_product");
            selectParam8.put("sqlType", "select");
            selectParam8.put("advCode", DbConfig.advCode);
            selectParam8.put("param", JsonUtil.object2Json(selectRequest8));
            String message8 = pc.processRequest(selectParam8);
            counts8= JsonUtil.jsonStr2TypeReference(message8, new TypeReference<List<product_count>>() {
            });


            Map<String, String> selectParam9 = new HashMap<String, String>();
            RequestDataBySelect selectRequest9 = new RequestDataBySelect();
            List<String> columns9 = new ArrayList<String>();
            columns9.add("count(*) as jtcount");
            selectRequest9.setParam("producttype in('交通预报')");
            selectRequest9.setColumns(columns9.toArray(new String[columns9.size()]));
            selectParam9.put("method", "base_product");
            selectParam9.put("sqlType", "select");
            selectParam9.put("advCode", DbConfig.advCode);
            selectParam9.put("param", JsonUtil.object2Json(selectRequest9));
            String message9 = pc.processRequest(selectParam9);
            counts9= JsonUtil.jsonStr2TypeReference(message9, new TypeReference<List<product_count>>() {
            });



            Map<String, String> selectParam10 = new HashMap<String, String>();
            RequestDataBySelect selectRequest10 = new RequestDataBySelect();
            List<String> columns10 = new ArrayList<String>();
            columns10.add("count(*) as tourcount");
            selectRequest10.setParam("producttype in('景点预报','景点森林火险预报','景观预报','景点城市火险预报','景点地质灾害预报')");
            selectRequest10.setColumns(columns10.toArray(new String[columns10.size()]));
            selectParam10.put("method", "base_product");
            selectParam10.put("sqlType", "select");
            selectParam10.put("advCode", DbConfig.advCode);
            selectParam10.put("param", JsonUtil.object2Json(selectRequest10));
            String message10 = pc.processRequest(selectParam10);
            counts10= JsonUtil.jsonStr2TypeReference(message10, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam11 = new HashMap<String, String>();
            RequestDataBySelect selectRequest11 = new RequestDataBySelect();
            List<String> columns11 = new ArrayList<String>();
            columns11.add("count(*) as dzcount");
            selectRequest11.setParam("producttype in('地质灾害预报')");
            selectRequest11.setColumns(columns11.toArray(new String[columns11.size()]));
            selectParam11.put("method", "base_product");
            selectParam11.put("sqlType", "select");
            selectParam11.put("advCode", DbConfig.advCode);
            selectParam11.put("param", JsonUtil.object2Json(selectRequest11));
            String message11 = pc.processRequest(selectParam11);
            counts11= JsonUtil.jsonStr2TypeReference(message11, new TypeReference<List<product_count>>() {
            });


            Map<String, String> selectParam12 = new HashMap<String, String>();
            RequestDataBySelect selectRequest12 = new RequestDataBySelect();
            List<String> columns12 = new ArrayList<String>();
            columns12.add("count(*) as slcount");
            selectRequest12.setParam("producttype in('山洪沟预警','雨情分析','山洪防汛预报')");
            selectRequest12.setColumns(columns12.toArray(new String[columns12.size()]));
            selectParam12.put("method", "base_product");
            selectParam12.put("sqlType", "select");
            selectParam12.put("advCode", DbConfig.advCode);
            selectParam12.put("param", JsonUtil.object2Json(selectRequest12));
            String message12 = pc.processRequest(selectParam12);
            counts12= JsonUtil.jsonStr2TypeReference(message12, new TypeReference<List<product_count>>() {
            });


            Map<String, String> selectParam13 = new HashMap<String, String>();
            RequestDataBySelect selectRequest13 = new RequestDataBySelect();
            List<String> columns13 = new ArrayList<String>();
            columns13.add("count(*) as cscount");
            selectRequest13.setParam("producttype in('城市内涝预报')");
            selectRequest13.setColumns(columns13.toArray(new String[columns13.size()]));
            selectParam13.put("method", "base_product");
            selectParam13.put("sqlType", "select");
            selectParam13.put("advCode", DbConfig.advCode);
            selectParam13.put("param", JsonUtil.object2Json(selectRequest13));
            String message13 = pc.processRequest(selectParam13);
            counts13= JsonUtil.jsonStr2TypeReference(message13, new TypeReference<List<product_count>>() {
            });

            Map<String, String> selectParam14 = new HashMap<String, String>();
            RequestDataBySelect selectRequest14 = new RequestDataBySelect();
            List<String> columns14 = new ArrayList<String>();
            columns14.add("count(*) as lycount");
            selectRequest14.setParam("producttype in('森林火险预报','专题服务')");
            selectRequest14.setColumns(columns14.toArray(new String[columns14.size()]));
            selectParam14.put("method", "base_product");
            selectParam14.put("sqlType", "select");
            selectParam14.put("advCode", DbConfig.advCode);
            selectParam14.put("param", JsonUtil.object2Json(selectRequest14));
            String message14 = pc.processRequest(selectParam14);
            counts14= JsonUtil.jsonStr2TypeReference(message14, new TypeReference<List<product_count>>() {
            });

            seriesItemMap = new HashMap<Object, Object>();
            seriesItemMap.put("nycount",counts.get(0).getNycount());
            seriesItemMap.put("dlcount",counts1.get(0).getDlcount());
            seriesItemMap.put("rbcount",counts2.get(0).getRbcount());
            seriesItemMap.put("ttcount",counts3.get(0).getTtcount());
            seriesItemMap.put("hbcount",counts4.get(0).getHbcount()+counts5.get(0).getHbcount1()+counts6.get(0).getHbcount2()+counts7.get(0).getHbcount3());
            seriesItemMap.put("yjcount",counts8.get(0).getYjcount());
            seriesItemMap.put("jtcount",counts9.get(0).getJtcount());
            seriesItemMap.put("tourcount",counts10.get(0).getTourcount());
            seriesItemMap.put("dzcount",counts11.get(0).getDzcount());
            seriesItemMap.put("slcount",counts12.get(0).getSlcount());
            seriesItemMap.put("cscount",counts13.get(0).getCscount());
            seriesItemMap.put("lycount",counts14.get(0).getLycount());
        } catch (Exception e) {
            // TODO: handle exception
        }
        return seriesItemMap;
    }
}
